local sk__limu = fk.CreateSkill {

  name = "sk__limu",

  tags = {  },

}



sk__limu:addEffect("active", {
  name = "sk__limu",
  anim_type = "drawcard",
  card_num = 1,
  target_num = 0,
  prompt = "#sk__limu",
  can_use = function(self, player)
    return not player:hasDelayedTrick("indulgence") and not table.contains(player.sealedSlots, Player.JudgeSlot) and
      player:usedSkillTimes(sk__limu.name, Player.HistoryPhase) == 0
  end,
  card_filter =function(self, player, to_select, selected)
    local card = Fk:getCardById(to_select)
    return #selected == 0 and card.suit == Card.Diamond and
      not player:isProhibited(player, Fk:cloneCard("indulgence", card.suit, card.number))
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    room:useVirtualCard("indulgence", effect.cards, player, player, sk__limu.name, true)
    if player:isWounded() then
      room:recover{
        who = player,
        num = 1,
        skillName = sk__limu.name,
      }
    end
    if not player.dead then
      player:drawCards(Fk:getCardById(effect.cards[1]).number, sk__limu.name)
    end
  end,
})

sk__limu:addEffect("targetmod", {
  name = "#sk__limu_targetmod",
  --sk__limu,
  bypass_times = function(self, player, skill, scope, card, to)
    return player:hasSkill(sk__limu.name) and #player:getCardIds("j") > 0
  end,
})

return sk__limu